<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改密码</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- 引入样式 -->
    <!--<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">-->
    <link rel="stylesheet" href="../css/theme-chalk.css">
    <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../css/style.css">

    <!-- 上传图片框样式，不使用上传组件可以删除此样式 -->
    <style>






        .el-container:nth-child(5) .el-aside,
        .el-container:nth-child(6) .el-aside {
            line-height: 260px;
        }

        .el-container:nth-child(7) .el-aside {
            line-height: 320px;
        }



        .avatar-uploader .el-upload {
            border: 1px dashed #d9d9d9;
            border-radius: 6px;
            cursor: pointer;
            position: relative;
            overflow: hidden;
        }

        .avatar-uploader .el-upload:hover {
            border-color: #409EFF;
        }

        .avatar-uploader-icon {
            font-size: 28px;
            color: #8c939d;
            width: 150px;
            height: 100px;
            line-height: 100px;
            text-align: center;
        }

        .avatar {
            width: 150px;
            height: 150px;
            display: block;
        }

    </style>
</head>
<body class="hold-transition">
<div id="app">

    <div class="content-header">
        <h1>管理
            <small>修改密码</small>
        </h1>
        <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>管理</el-breadcrumb-item>
            <el-breadcrumb-item>账户设置</el-breadcrumb-item>
        </el-breadcrumb>
    </div>


    <div class="app-container" align="center">
        <div class="box" style="width: 300px">
            <div class="filter-container" >

                <el-container>
                    <el-header>修改密码</el-header>
                    <el-main>

                        <!--<el-upload
                                class="avatar-uploader"
                                action="https://jsonplaceholder.typicode.com/posts/"
                                :show-file-list="false"
                                :on-success="handleAvatarSuccess"
                                :before-upload="beforeAvatarUpload">
                            <img v-if="imageUrl" :src="imageUrl" class="avatar">
                            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                        </el-upload>-->

                        <el-form  label-width="100px">
                            <el-form-item label="用户名">
                                <el-input type="text" v-model="pojo.loginName" disabled="disabled"></el-input>
                            </el-form-item>

                            <el-form-item label="旧密码" prop="oldpassword">
                                <el-input type="password" v-model="passwordMap.oldPassword" auto-complete="off"></el-input>
                            </el-form-item>


                            <el-form-item label="新密码" prop="newPassword">
                                <el-input type="password" v-model="passwordMap.newPassword" auto-complete="off"></el-input>
                            </el-form-item>

                            <el-form-item label="确认密码" prop="againPassword">
                                <el-input type="password" v-model="passwordMap.againPassword" auto-complete="off"></el-input>
                            </el-form-item>


                            <el-form-item>
                                <el-button type="primary" @click="update()">提交</el-button>

                            </el-form-item>


                        </el-form>

                    </el-main>
                </el-container>




            </div>
        </div>
    </div>


</div>
</body>
<script src="/js/vue.js"></script>
<script src="/js/axios.js"></script>
<script src="/js/elementui.js"></script>
<script>
    new Vue({
        el:'#app',
        data(){
            return{
                tableData:[],
                pojo:{},
                passwordMap:{}
            }
        },
        created(){
            this.fetchData();
        },
        methods:{
            fetchData(){
                axios.get(`/admin/findByName.do`).then(response=>{
                    this.pojo=response.data;
                });
            },
            update(){
                axios.post(`/admin/updatePassword.do`,this.passwordMap).then(response=>{
                    if (response.data.code == 0){
                        //成功
                        alert(response.data.message);
                        location.href="/system/admin.html"
                    } else{
                        alert(response.data.message);
                    }
                });
            }

        }
    })

</script>
</html>
